<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
	<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
	<TITLE></TITLE>
	<META NAME="GENERATOR" CONTENT="OpenOffice.org 2.0  (Win32)">
	<META NAME="CREATED" CONTENT="20040324;13083000">
	<META NAME="CHANGEDBY" CONTENT="Xavier Le Vourch">
	<META NAME="CHANGED" CONTENT="20060831;17571871">
	<META NAME="SDENDNOTE" CONTENT="ARABIC">
	<STYLE>
	<!--
		@page { size: 8.5in 11in; margin-left: 1.25in; margin-right: 1.25in; margin-top: 1in; margin-bottom: 1in }
		P { margin-bottom: 0.08in }
		H1 { margin-bottom: 0.08in }
		H1.western { font-family: "Arial", sans-serif; font-size: 16pt }
		H1.cjk { font-family: "MS Mincho"; font-size: 16pt }
		H1.ctl { font-family: "Tahoma"; font-size: 16pt }
		H2 { margin-bottom: 0.08in }
		H2.western { font-family: "Arial", sans-serif; font-size: 14pt; font-style: italic }
		H2.cjk { font-family: "MS Mincho"; font-size: 14pt; font-style: italic }
		H2.ctl { font-size: 14pt; font-style: italic }
		H3 { margin-bottom: 0.08in }
		H3.western { font-family: "Arial", sans-serif }
		H3.cjk { font-family: "MS Mincho" }
		H4 { margin-bottom: 0.08in }
		H4.western { font-family: "Arial", sans-serif; font-size: 11pt; font-style: italic }
		H4.cjk { font-family: "MS Mincho"; font-size: 11pt; font-style: italic }
		H4.ctl { font-size: 11pt; font-style: italic }
		TD P { margin-bottom: 0.08in }
		TH P { margin-bottom: 0.08in }
	-->
	</STYLE>
</HEAD>
<BODY LANG="en-US" DIR="LTR">
<H1 CLASS="western" ALIGN=CENTER></H1>
<H1 CLASS="western" ALIGN=CENTER><FONT FACE="Verdana, sans-serif"><FONT SIZE=5 STYLE="font-size: 20pt">Retroweaver
&ndash; A Developer's Guide</FONT></FONT></H1>
<P ALIGN=LEFT>    <FONT FACE="Verdana, sans-serif">Gotta Get Back In
Time</FONT></P>
<P ALIGN=RIGHT><IMG SRC="retroweaver-guide.jpg" NAME="graphics1" ALIGN=LEFT WIDTH=240 HEIGHT=320 BORDER=0><BR CLEAR=LEFT><BR><BR>
</P>
<P ALIGN=RIGHT><BR><BR>
</P>
<P ALIGN=RIGHT><BR><BR>
</P>
<P ALIGN=RIGHT><BR><BR>
</P>
<P ALIGN=RIGHT><BR><BR>
</P>
<P ALIGN=RIGHT><BR><BR>
</P>
<P ALIGN=RIGHT><BR><BR>
</P>
<P ALIGN=RIGHT><BR><BR>
</P>
<P ALIGN=RIGHT><BR><BR>
</P>
<P ALIGN=RIGHT><BR><BR>
</P>
<P ALIGN=RIGHT><BR><BR>
</P>
<P ALIGN=RIGHT><BR><BR>
</P>
<P ALIGN=RIGHT><BR><BR>
</P>
<P ALIGN=RIGHT><BR><BR>
</P>
<P ALIGN=RIGHT><FONT FACE="Verdana, sans-serif">Toby Reyelts</FONT></P>
<P ALIGN=RIGHT><FONT FACE="Verdana, sans-serif">10/2004</FONT></P>
<H2 CLASS="western" ALIGN=LEFT STYLE="background: transparent; page-break-before: always">
<FONT FACE="Verdana, sans-serif"><FONT SIZE=4 STYLE="font-size: 16pt"><B>Chapter
1: Getting Started</B></FONT></FONT></H2>
<P ALIGN=CENTER><BR><BR>
</P>
<H3 CLASS="western" STYLE="background: #e6e6e6; font-style: normal; font-weight: medium">
<FONT FACE="Verdana, sans-serif"><FONT SIZE=4>Downloading Retroweaver</FONT></FONT></H3>
<P><FONT FACE="Verdana, sans-serif">If you haven't done so already,
you should download the latest version of Retroweaver and its
associated documentation from <A HREF="http://retroweaver.sf.net/">http://retroweaver.sf.net</A>.</FONT></P>
<P><BR><BR>
</P>
<H4 CLASS="western" STYLE="background: #e6e6e6; font-style: normal; font-weight: medium">
<FONT FACE="Verdana, sans-serif"><FONT SIZE=4>The Fine Print</FONT></FONT></H4>
<P><FONT FACE="Verdana, sans-serif">Before you begin using
Retroweaver, you might like to have your well-paid lawyers review the
BSD-style license for use. (NB: There's nothing really fine about
fine print.)</FONT></P>
<P><BR><BR>
</P>
<P><FONT FACE="Verdana, sans-serif"><FONT SIZE=1 STYLE="font-size: 8pt">Copyright
(c) February 2004, Toby Reyelts</FONT></FONT></P>
<P><FONT FACE="Verdana, sans-serif"><FONT SIZE=1 STYLE="font-size: 8pt">All
rights reserved.</FONT></FONT></P>
<P><BR><BR>
</P>
<P><FONT FACE="Verdana, sans-serif"><FONT SIZE=1 STYLE="font-size: 8pt">Redistribution
and use in source and binary forms, with or without modification, </FONT></FONT>
</P>
<P><FONT FACE="Verdana, sans-serif"><FONT SIZE=1 STYLE="font-size: 8pt">are
permitted provided that the following conditions are met:</FONT></FONT></P>
<P><BR><BR>
</P>
<P><FONT FACE="Verdana, sans-serif"><FONT SIZE=1 STYLE="font-size: 8pt">Redistributions
of source code must retain the above copyright notice, </FONT></FONT>
</P>
<P><FONT FACE="Verdana, sans-serif"><FONT SIZE=1 STYLE="font-size: 8pt">this
list of conditions and the following disclaimer. </FONT></FONT>
</P>
<P><FONT FACE="Verdana, sans-serif"><FONT SIZE=1 STYLE="font-size: 8pt">Redistributions
in binary form must reproduce the above copyright notice, </FONT></FONT>
</P>
<P><FONT FACE="Verdana, sans-serif"><FONT SIZE=1 STYLE="font-size: 8pt">this
list of conditions and the following disclaimer in the documentation </FONT></FONT>
</P>
<P><FONT FACE="Verdana, sans-serif"><FONT SIZE=1 STYLE="font-size: 8pt">and/or
other materials provided with the distribution. </FONT></FONT>
</P>
<P><FONT FACE="Verdana, sans-serif"><FONT SIZE=1 STYLE="font-size: 8pt">Neither
the name of Toby Reyelts nor the names of his contributors </FONT></FONT>
</P>
<P><FONT FACE="Verdana, sans-serif"><FONT SIZE=1 STYLE="font-size: 8pt">may
be used to endorse or promote products derived from this software </FONT></FONT>
</P>
<P><FONT FACE="Verdana, sans-serif"><FONT SIZE=1 STYLE="font-size: 8pt">without
specific prior written permission. </FONT></FONT>
</P>
<P><BR><BR>
</P>
<P><FONT FACE="Verdana, sans-serif"><FONT SIZE=1 STYLE="font-size: 8pt">THIS
SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS
IS&quot; </FONT></FONT>
</P>
<P><FONT FACE="Verdana, sans-serif"><FONT SIZE=1 STYLE="font-size: 8pt">AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
</FONT></FONT>
</P>
<P><FONT FACE="Verdana, sans-serif"><FONT SIZE=1 STYLE="font-size: 8pt">IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE </FONT></FONT>
</P>
<P><FONT FACE="Verdana, sans-serif"><FONT SIZE=1 STYLE="font-size: 8pt">ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE </FONT></FONT>
</P>
<P><FONT FACE="Verdana, sans-serif"><FONT SIZE=1 STYLE="font-size: 8pt">LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR </FONT></FONT>
</P>
<P><FONT FACE="Verdana, sans-serif"><FONT SIZE=1 STYLE="font-size: 8pt">CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE </FONT></FONT>
</P>
<P><FONT FACE="Verdana, sans-serif"><FONT SIZE=1 STYLE="font-size: 8pt">GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
</FONT></FONT>
</P>
<P><FONT FACE="Verdana, sans-serif"><FONT SIZE=1 STYLE="font-size: 8pt">HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, </FONT></FONT>
</P>
<P><FONT FACE="Verdana, sans-serif"><FONT SIZE=1 STYLE="font-size: 8pt">OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
THE USE OF </FONT></FONT>
</P>
<P><FONT FACE="Verdana, sans-serif"><FONT SIZE=1 STYLE="font-size: 8pt">THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</FONT></FONT></P>
<P><BR><BR>
</P>
<P STYLE="font-style: normal; font-weight: medium"><BR><BR>
</P>
<H4 CLASS="western" STYLE="background: #e6e6e6; font-style: normal; font-weight: medium">
<FONT FACE="Verdana, sans-serif"><FONT SIZE=4>Installation</FONT></FONT></H4>
<P STYLE="background: transparent; font-style: normal; font-weight: medium">
<FONT FACE="Verdana, sans-serif"><FONT SIZE=3>Once you've downloaded
retroweaver-&lt;version&gt;.zip, you can unzip the contents to your
favorite folder. When you've finished that process, you'll be
presented with the following set of folders:</FONT></FONT></P>
<UL>
	<LI><P STYLE="background: transparent; font-style: normal; font-weight: medium">
	<FONT FACE="Verdana, sans-serif"><FONT SIZE=3>docs &ndash; All of
	the documentation for Retroweaver (including the Developer's Guide
	you're reading right now).</FONT></FONT></P>
	<LI><P STYLE="background: transparent"><FONT FACE="Verdana, sans-serif">lib
	&ndash; Third party libraries that Retroweaver needs in order to
	perform the bytecode weaving. These libraries are only required
	during weaving, not deployment, of your application.</FONT></P>
	<LI><P STYLE="background: transparent"><FONT FACE="Verdana, sans-serif">release
	&ndash; Contains the Retroweaver runtime library, 
	retroweaver-rt<SPAN STYLE="font-weight: medium"><SPAN STYLE="font-style: normal"><FONT SIZE=3>-&lt;version&gt;</FONT></SPAN></SPAN>.jar,
	which you must deploy with your application. Contains the full
	Retroweaver application, retroweaver<SPAN STYLE="font-weight: medium"><SPAN STYLE="font-style: normal"><FONT SIZE=3>-&lt;version&gt;</FONT></SPAN></SPAN>.jar,
	which you use to weave your application or start the Retroweaver
	graphical interface. Also contains retroweaver-all<SPAN STYLE="font-weight: medium"><SPAN STYLE="font-style: normal"><FONT SIZE=3>-&lt;version&gt;</FONT></SPAN></SPAN>.jar
	which includes all Retroweaver classes along with the required
	libraries. </FONT>
	</P>
	<LI><P STYLE="background: transparent"><FONT FACE="Verdana, sans-serif">src
	&ndash; All of the Java source code for both the bytecode weaver and
	the runtime library. Feel free to browse through here and send some
	advice my way.</FONT></P>
	<LI><P STYLE="background: transparent"><FONT FACE="Verdana, sans-serif">src/net/sourceforge/retroweaver/tests
	&ndash; The source for a suite of test cases that get executed
	against Retroweaver. If you're not sure that Retroweaver can handle
	a particular construct or condition, write a test case. If you're so
	inclined, send it my way. I'd love to include it in Retroweaver's
	test suite.</FONT></P>
	<LI><P STYLE="background: transparent"><FONT FACE="Verdana, sans-serif">release/retroweaver-tests-&lt;version&gt;.jar
	&ndash; The compiled and retroweaved classes from the test suite.
	You can run these to give yourself warm fuzzies about Retroweaver's
	behavior.</FONT></P>
</UL>
<P STYLE="margin-left: 0.98in; background: transparent"><BR><BR>
</P>
<H2 CLASS="western" ALIGN=LEFT STYLE="background: transparent; page-break-before: always">
<FONT FACE="Verdana, sans-serif"><FONT SIZE=4 STYLE="font-size: 16pt"><B>Chapter
2: An Overview</B></FONT></FONT></H2>
<H3 CLASS="western" STYLE="background: transparent; font-weight: medium">
</H3>
<H3 CLASS="western" STYLE="background: #e6e6e6; font-weight: medium"><FONT FACE="Verdana, sans-serif">Why
Retroweaver?</FONT></H3>
<P><FONT FACE="Verdana, sans-serif">Sun has just released their
latest and greatest version of the Java developer's kit &ndash; JDK
1.5. There is something that really differentiates this version from
earlier releases, though &ndash; new language features. </FONT>
</P>
<P><BR><BR>
</P>
<P><FONT FACE="Verdana, sans-serif">JDK 1.5 has new support for
generics, autoboxing, static imports, enums, extended for loops,
annotations, and varargs. The Java language has just undergone its
largest change ever, and if you're anything like me, you want to take
advantage of all of these new wonderful enhancements. Unfortunately,
if you're anything like me, you also have some problems that are
likely to get in your way:</FONT></P>
<P><BR><BR>
</P>
<UL>
	<LI><P><FONT FACE="Verdana, sans-serif">JDK 1.5 is a new product,
	and you or your manager may not be very fond of relying on untested
	virtual machines.</FONT></P>
</UL>
<UL>
	<LI><P><FONT FACE="Verdana, sans-serif">Your product may rely on
	other 3<SUP>rd</SUP> party products that aren't supported on 1.5
	(persistence engines, ui frameworks, and application servers are
	common examples).</FONT></P>
</UL>
<UL>
	<LI><P><FONT FACE="Verdana, sans-serif">Your clients may not be able
	to install the latest version of the JVM &ndash; a typical scenario
	for companies that deploy applets or applications via WebStart.</FONT></P>
</UL>
<P><BR><BR>
</P>
<P><FONT FACE="Verdana, sans-serif">Retroweaver is  a solution to all
of these problems. Retroweaver enables you to develop your product
using the new 1.5 Java language, while retaining binary compatibility
with previous VMs &ndash; all the way back to JDK 1.2.</FONT></P>
<P><BR><BR>
</P>
<H3 CLASS="western" STYLE="background: transparent; font-weight: medium; page-break-before: always">
</H3>
<H3 CLASS="western" STYLE="background: #e6e6e6; font-weight: medium"><FONT FACE="Verdana, sans-serif">Using
Retroweaver</FONT></H3>
<P STYLE="background: transparent; font-weight: medium"><FONT FACE="Verdana, sans-serif">If
you've bothered to read this far, you're probably interested in
learning how to use Retroweaver with your own product. The process is
surprisingly easy.</FONT></P>
<OL>
	<LI><P STYLE="background: transparent; font-weight: medium"><FONT FACE="Verdana, sans-serif">Download
	and install JDK 1.5. (Seriously &ndash; it's very tough to develop
	Java programs without a Java compiler).</FONT></P>
	<LI><P STYLE="background: transparent; font-weight: medium"><FONT FACE="Verdana, sans-serif">Write
	your source code using all of those new powerful language features
	that you love in 1.5.</FONT></P>
	<LI><P STYLE="background: transparent; font-weight: medium"><FONT FACE="Verdana, sans-serif">Compile
	your code and run Retroweaver against the class files. You can run
	Retroweaver in a few different ways.</FONT></P>
</OL>
<UL>
	<LI><P STYLE="background: transparent; font-weight: medium"><FONT FACE="Verdana, sans-serif">Use
	the graphical interface. Just double-click on the executable jar
	file, retroweaver-&lt;version&gt;.jar, or execute java -jar
	release/retroweaver-&lt;version&gt;.jar. This is a good way to start
	getting used to Retroweaver.</FONT></P>
</UL>
<UL>
	<LI><P STYLE="background: transparent"><SPAN STYLE="font-weight: medium"><FONT FACE="Verdana, sans-serif">Run
	Retroweaver from the command line. That looks like:<BR><BR></FONT></SPAN><FONT SIZE=2><FONT FACE="Courier">java
	-cp
	release\retroweaver-&lt;version&gt;.jar;lib\asm-2.2.jar;lib\asm-commons-2.2.jar
	net.sourceforge.retroweaver.Weaver -source classes</FONT></FONT></P>
	<P STYLE="background: transparent"><FONT FACE="Courier"><FONT SIZE=2>or
	when weaving a jar file:</FONT></FONT></P>
	<P STYLE="background: transparent"><FONT FACE="Courier"><FONT SIZE=2>java
	-cp
	release\retroweaver-&lt;version&gt;.jar;lib\asm-2.2.jar;lib\asm-commons-2.2.jar
	net.sourceforge.retroweaver.Weaver -jar input.jar output.jar</FONT></FONT></P>
	<LI><P STYLE="background: transparent; font-weight: medium; line-height: 100%; page-break-inside: avoid; page-break-before: auto; page-break-after: auto">
	<FONT FACE="Verdana, sans-serif">Add Retroweaver to your build
	script. This is the best way to integrate Retroweaver into your day
	to day development cycle. Retroweaver comes with a built-in Ant task
	&ndash; net.sourceforge.retroweaver.ant.RetroWeaverTask. See the
	Appendix for details.</FONT></P>
	<LI><P STYLE="background: transparent; font-weight: medium; line-height: 100%">
	<FONT FACE="Verdana, sans-serif">Weave classes on the fly at runtime
	with WeaveRunner, a custom ClassLoader weaving classes at runtime:</FONT></P>
	<P STYLE="background: transparent; font-weight: medium; line-height: 100%">
	<FONT FACE="Courier"><FONT SIZE=2>java -cp
	release\retroweaver-all-&lt;version&gt;.jar
	net.sourceforge.retroweaver.WeaveRunner -cp &lt;application class
	path&gt; &lt;Main Class&gt; &lt;arguments&gt;</FONT></FONT></P>
</UL>
<P STYLE="margin-left: 0.49in; background: transparent; font-weight: medium; line-height: 100%; page-break-inside: avoid; page-break-before: auto; page-break-after: auto">
     
</P>
<OL START=4>
	<LI><P STYLE="background: transparent; font-weight: medium; line-height: 100%; page-break-inside: avoid">
	<FONT FACE="Verdana, sans-serif">Deploy your application, including
	the Retroweaver runtime library, retroweaver-rt.jar.</FONT></P>
</OL>
<P STYLE="background: transparent; line-height: 100%; page-break-inside: avoid">
<BR><BR>
</P>
<H2 CLASS="western" ALIGN=LEFT STYLE="background: transparent; page-break-before: always">
<FONT FACE="Verdana, sans-serif"><FONT SIZE=4 STYLE="font-size: 16pt"><B>Chapter
3: Reference Verification</B></FONT></FONT></H2>
<P ALIGN=LEFT STYLE="background: transparent"><BR><BR>
</P>
<H3 CLASS="western" ALIGN=LEFT STYLE="background: #e6e6e6; font-weight: medium">
<FONT FACE="Verdana, sans-serif"><FONT SIZE=4>Excuse Me?</FONT></FONT></H3>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"><FONT FACE="Verdana, sans-serif"><FONT SIZE=3>While
cross-compiling your code to another virtual machine, you need to
make sure you don't reference runtime code that doesn't exist in your
target VM. Prior to JDK 1.5, this was most easily achieved by using
the switch -Xbootclasspath/p, and pointing it to the rt.jar of your
target VM. The java compiler would complain if you referenced
classes, methods, or fields that didn't exist in the target VM. For
lack of a better name, we'll call this process, <I>reference
verification</I>.</FONT></FONT></P>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"><BR><BR>
</P>
<H3 CLASS="western" ALIGN=LEFT STYLE="background: #e6e6e6; font-weight: medium">
<FONT FACE="Verdana, sans-serif"><FONT SIZE=4>Now What?</FONT></FONT></H3>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"><FONT FACE="Verdana, sans-serif"><FONT SIZE=3>The
bad news is that, due to the nature of Retroweaver, it is not
possible to use the bootclasspath switch to perform reference
verification in conjunction with Retroweaver. The good news is that
Retroweaver comes with its own reference verifier. Retroweaver's
reference verifier will warn you if any of your code references a
class, method, or field that it can't find in your target VM. To turn
on Retroweaver's reference verifier, specify the -verifyrefs switch.
You'll have to pass the classpath that contains your target JDK's
rt.jar, Retroweaver's runtime library, and all of the classes that
your application uses. For example,</FONT></FONT></P>
<P ALIGN=LEFT STYLE="margin-left: 0.49in; background: transparent; font-weight: medium">
<BR><BR>
</P>
<P ALIGN=LEFT STYLE="margin-left: 0.49in; background: transparent; font-weight: medium">
<FONT FACE="Courier"><FONT SIZE=2>java -cp
release\retroweaver-&lt;version&gt;.jar;lib\asm-2.2.jar;lib\asm-commons-2.2.jar
net.sourceforge.retroweaver.Weaver -source classes -verifyrefs
c:\java\jdk1.4\lib\rt.jar;release\retroweaver-rt-&lt;version&gt;.jar;compiled-classes;lib\lib1.jar;lib\lib2.jar</FONT></FONT></P>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"><BR><BR>
</P>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"><FONT FACE="Verdana, sans-serif"><FONT SIZE=3>When
Retroweaver encounters a reference to a class/method/field that can't
be located on the classpath specified with -verifyrefs, it issues a
warning, so you can locate and correct the issue.</FONT></FONT></P>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"><BR><BR>
</P>
<H2 CLASS="western" ALIGN=LEFT STYLE="background: transparent; page-break-before: always">
<FONT FACE="Verdana, sans-serif"><FONT SIZE=4 STYLE="font-size: 16pt"><B>Chapter
4: The Dirty Details</B></FONT></FONT></H2>
<P ALIGN=LEFT STYLE="background: transparent"><BR><BR>
</P>
<H3 CLASS="western" ALIGN=LEFT STYLE="background: #e6e6e6; font-weight: medium">
<FONT FACE="Verdana, sans-serif"><FONT SIZE=4>Why This Chapter?</FONT></FONT></H3>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"><FONT FACE="Verdana, sans-serif"><FONT SIZE=3>Since
Retroweaver functions by bytecode enhancement, it operates
more-or-less, like a black box. This section strives to assuage any
concerns that people may have about this technique, by explaining the
underlying pinnings of Retroweaver, while avoiding the tediousness of
reviewing the entire source code base.</FONT></FONT></P>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"><BR><BR>
</P>
<H3 CLASS="western" ALIGN=LEFT STYLE="background: #e6e6e6; font-weight: medium">
<FONT FACE="Verdana, sans-serif"><FONT SIZE=4>Why Bytecode
Enhancement?</FONT></FONT></H3>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"><FONT FACE="Verdana, sans-serif"><FONT SIZE=3>There
were a set of design approaches available to achieving Retroweaver's
end goal &ndash; 1.5 source code running on an earlier virtual
machine. The top approaches, aside from bytecode enhancement, were:</FONT></FONT></P>
<UL>
	<LI><P ALIGN=LEFT STYLE="background: transparent; font-weight: medium">
	<FONT FACE="Verdana, sans-serif"><FONT SIZE=3>Generate 1.4 source
	code from 1.5 source code.<BR><BR>While this approach sounds nice,
	it's simply infeasible. It's just not possible to generate 1.4
	source code, for all possible language constructs in 1.5. Sun's
	compiler team has confirmed this, itself.<BR></FONT></FONT><BR><BR>
	</P>
	<LI><P ALIGN=LEFT STYLE="background: transparent; font-weight: medium">
	<FONT FACE="Verdana, sans-serif"><FONT SIZE=3>Develop a 1.5 compiler
	that can target 1.4.<BR><BR>This is definitely a valid approach. In
	fact, given all the time in the world, this is probably the best
	approach. The primary problem, here, is that developing a 1.5
	compiler is a significantly complex task &ndash; much moreso than
	just the development of Retroweaver. For example, to date, there are
	still significant bugs in Sun's own 1.5 compiler. Eventually, I
	believe we will see compilers for 1.5, that also support -target
	1.4. Until then, there is Retroweaver.</FONT></FONT></P>
</UL>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"><BR><BR>
</P>
<H3 CLASS="western" ALIGN=LEFT STYLE="background: #e6e6e6; font-weight: medium">
<FONT FACE="Verdana, sans-serif"><FONT SIZE=4>Step By Step</FONT></FONT></H3>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"><FONT FACE="Verdana, sans-serif"><FONT SIZE=3>The
changes that Retroweaver makes to class files, can be roughly divided
into two categories &ndash; format changes and runtime changes. </FONT></FONT>
</P>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"><BR><BR>
</P>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"><FONT FACE="Verdana, sans-serif"><FONT SIZE=3>Format
changes are changes which are required due to specification updates
in the JVM. They include:</FONT></FONT></P>
<OL>
	<LI><P ALIGN=LEFT STYLE="background: transparent; font-weight: medium">
	<FONT FACE="Verdana, sans-serif"><FONT SIZE=3>Replacement of &ldquo;+&rdquo;
	characters with &ldquo;$&rdquo; characters in identifiers. <BR><BR>The
	new JDK 1.5 specification has relaxed the rules concerning Java
	language identifiers, to allow &ldquo;+&rdquo; characters.
	Retroweaver replaces the &ldquo;+&rdquo; characters with &ldquo;$&rdquo;
	characters, which are legal in earlier virtual machines. Retroweaver
	also renames class files which have &ldquo;+&rdquo; characters in
	their names.<BR></FONT></FONT><BR><BR>
	</P>
	<LI><P ALIGN=LEFT STYLE="background: transparent; font-weight: medium">
	<FONT FACE="Verdana, sans-serif"><FONT SIZE=3>Replacement of LDC and
	LDC_W instructions which have a CONSTANT_Class target. <BR><BR>In
	JDK 1.5, these two instructions have been updated to work on class
	literals, for example, String.class. Prior to JDK 1.5, a
	programmer's use of a class literal resulted in the compiler
	generation of a method to execute a Class.forName. Retroweaver
	preserves the older behavior. <BR></FONT></FONT><BR><BR>
	</P>
	<LI><P ALIGN=LEFT STYLE="background: transparent; font-weight: medium">
	<FONT FACE="Verdana, sans-serif"><FONT SIZE=3>Replacement of
	Synthetic access specifiers with Synthetic attributes.<BR><BR>In JDK
	1.5, Synthetic access specifiers were introduced to replace
	Synthetic attributes and reduce the size of class files. Retroweaver
	reverses the operation by replacing Synthetic access specifiers with
	Synthetic attributes.<BR></FONT></FONT><BR><BR>
	</P>
	<LI><P ALIGN=LEFT STYLE="background: transparent; font-weight: medium">
	<FONT FACE="Verdana, sans-serif"><FONT SIZE=3>Removal of JDK 1.5 bit
	assignments from access specifiers.<BR><BR>The JVM specification
	(second edition) states that unassigned bits of the access
	specifiers for classes, methods, and fields should be set to 0 by
	compilers and bytecode generators. It also states that JVMs must
	ignore those bits, but to be perfectly compliant, Retroweaver resets
	them to 0.</FONT></FONT></P>
</OL>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"><BR><BR>
</P>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"><FONT FACE="Verdana, sans-serif"><FONT SIZE=3>Runtime
changes are changes which are required due to the addition of new
classes to the JDK runtime library. They include:<BR></FONT></FONT><BR><BR>
</P>
<OL>
	<LI><P ALIGN=LEFT STYLE="background: transparent; font-weight: medium">
	<FONT FACE="Verdana, sans-serif"><FONT SIZE=3><SPAN LANG="en-US">Replacement</SPAN>
	of calls to StringBuilder with StringBuffer. <BR><BR>StringBuilder
	is a new class introduced into 1.5 as an unsynchronized version of
	StringBuffer that maintains the same interface as StringBuffer. The
	JDK 1.5 compiler generates calls to StringBuilder, when you use the
	&ldquo;+&rdquo; operator on Strings. Retroweaver replaces those
	calls to StringBuilder, with calls to StringBuffer. <BR></FONT></FONT><BR><BR>
	</P>
	<LI><P ALIGN=LEFT STYLE="background: transparent; font-weight: medium">
	<FONT FACE="Verdana, sans-serif"><FONT SIZE=3>Replacement of calls
	to &lt;PrimitiveWrapper&gt;.valueOf( &lt;primitive&gt; )
	methods.<BR><BR>In JDK 1.5, the new autoboxing specification
	prompted the introduction of new valueOf() methods to the primitive
	wrapper classes, for example, Long.valueOf( long ). These methods
	facilitate autoboxing, not only by boxing a primitive value, but by
	supporting other features of the autoboxing specification (i.e.
	mandated/optional caching behavior). Retroweaver replaces calls to
	these methods with calls to its own runtime library, which
	implements autoboxing according to the specification.<BR></FONT></FONT><BR><BR>
	</P>
	<LI><P ALIGN=LEFT STYLE="background: transparent; font-weight: medium">
	<FONT FACE="Verdana, sans-serif"><FONT SIZE=3>Replacement of
	references to java.lang.Enum.<BR><BR>The new support for first class
	enumerations in JDK 1.5 requires a base enum class, java.lang.Enum.
	Retroweaver replaces references to java.lang.Enum with
	net.sourceforge.retroweaver.runtime.Enum_, which is primarily a
	clone of java.lang.Enum. This means that enum values are made
	subclasses of Enum_, and methods which would operate on Enum,
	operate on Enum_, instead. Enum_ implements the enum behavior
	specified in the enumeration specification, including guaranteed
	singleton behavior, even in the face of serialization.<BR></FONT></FONT><BR><BR>
	</P>
	<LI><P ALIGN=LEFT STYLE="background: transparent; font-weight: medium">
	<FONT FACE="Verdana, sans-serif"><FONT SIZE=3>Replacement of
	references to java.lang.Iterable.<BR><BR>The new extended for loop
	syntax in JDK 1.5 required a new interface, java.lang.Iterable.
	Retroweaver replaces references to java.lang.Iterable with its own
	runtime class, net.sourceforge.retroweaver.runtime.Iterable_. This
	allows developers to continue to use the extended for loop and to
	even create implementations of Iterable, as they would with JDK
	1.5.<BR></FONT></FONT><BR><BR>
	</P>
</OL>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"><BR><BR>
</P>
<H3 CLASS="western" ALIGN=LEFT STYLE="background: #e6e6e6; font-weight: medium">
<FONT FACE="Verdana, sans-serif"><FONT SIZE=4>Other Features</FONT></FONT></H3>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium">&ldquo;<FONT FACE="Verdana, sans-serif"><FONT SIZE=3>Wait,&rdquo;,
you say, &ldquo;I thought Retroweaver also supports static imports,
varargs, and generics, but I saw no mention of them, here.&rdquo;<BR><BR>It
is true that Retroweaver does support these features, it's just that
these features require no special support from Retroweaver. <BR><BR>The
new static import language feature is just a compiler directive. It
has no effect whatsoever on generated class files. <BR><BR>The new
varargs language feature introduces a new access specifier, but that
access specifier is used only by JDK 1.5 compilers and ignored by
earlier compilers. Vararg methods will appear as vararg under 1.5,
while appearing with array arguments under previous compilers, as you
would expect. For example,</FONT></FONT></P>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium">
<FONT FACE="Verdana, sans-serif"><FONT SIZE=3><BR><FONT FACE="Courier, monospace">public
void foo( String... ) {</FONT></FONT></FONT></P>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"><FONT FACE="Courier, monospace"><FONT SIZE=3>}
</FONT></FONT>
</P>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"><BR><BR>
</P>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"><FONT FACE="Verdana, sans-serif"><FONT SIZE=3>would
appear as</FONT></FONT></P>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"><BR><BR>
</P>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"><FONT FACE="Courier, monospace"><FONT SIZE=3>public
void foo( String[] ) {</FONT></FONT></P>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"><FONT FACE="Verdana, sans-serif"><FONT SIZE=3><FONT FACE="Courier, monospace">}<BR></FONT><BR></FONT></FONT><BR><BR>
</P>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"><FONT FACE="Verdana, sans-serif"><FONT SIZE=3>The
addition of generics requires a new Signature attribute, which,
again, is only used by JDK 1.5 compilers and ignored by earlier
compilers. Generic methods appear generic under 1.5, but appear as
their type-erased equivalents under previous compilers. For example,</FONT></FONT></P>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"><BR><BR>
</P>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"><FONT FACE="Courier, monospace"><FONT SIZE=3>public
class Foo&lt;T extends Comparable&gt; {</FONT></FONT></P>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"> 
<FONT FACE="Courier, monospace"><FONT SIZE=3>public void foo( T t ) {</FONT></FONT></P>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"> 
<FONT FACE="Courier, monospace"><FONT SIZE=3>}</FONT></FONT></P>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"><FONT FACE="Courier, monospace"><FONT SIZE=3>}</FONT></FONT></P>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"><BR><BR>
</P>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"><FONT FACE="Verdana, sans-serif"><FONT SIZE=3>would
appear as </FONT></FONT>
</P>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"><BR><BR>
</P>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"><FONT FACE="Courier, monospace"><FONT SIZE=3>public
class Foo {</FONT></FONT></P>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"> 
<FONT FACE="Courier, monospace"><FONT SIZE=3>public void foo(
Comparable t ) {</FONT></FONT></P>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"> 
<FONT FACE="Courier, monospace"><FONT SIZE=3>}</FONT></FONT></P>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"><FONT FACE="Courier, monospace"><FONT SIZE=3>}</FONT></FONT></P>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"><BR><BR>
</P>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"><BR><BR>
</P>
<H2 CLASS="western" ALIGN=LEFT STYLE="background: transparent; page-break-before: always">
<FONT FACE="Verdana, sans-serif"><FONT SIZE=4 STYLE="font-size: 16pt"><B>Chapter
5: Pitfall Harry</B></FONT></FONT></H2>
<P ALIGN=LEFT STYLE="background: transparent"><BR><BR>
</P>
<H3 CLASS="western" ALIGN=LEFT STYLE="background: #e6e6e6; font-weight: medium">
<FONT FACE="Verdana, sans-serif"><FONT SIZE=4>Frequently Asked
Questions</FONT></FONT></H3>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"><BR><BR>
</P>
<UL>
	<LI><P ALIGN=LEFT STYLE="background: transparent; font-weight: medium">
	<FONT FACE="Verdana, sans-serif"><FONT SIZE=3>Why am I getting a
	NoClassDefFoundError/ClassNotFoundException?<BR><BR>It depends. <BR><BR>Is
	it for a class that is in net.sourceforge.retroweaver.runtime? You
	should make sure you're including retroweaver-rt-&lt;version&gt;.jar
	in your application class path.<BR><BR>Is it for one of the JDK
	classes? If you're using a class that is new to JDK 1.5, stop.
	Retroweaver has support for a few special classes (java.lang.Enum,
	java.lang.Iterable, and java.lang.StringBuilder), but that's it. You
	can't use any other classes that are new to JDK 1.5. You can turn on
	the -verifyrefs option on Retroweaver to receive warnings when you
	reference classes, fields, or methods that don't exist in the VM
	that you are targetting.<BR></FONT></FONT><BR><BR>
	</P>
	<LI><P ALIGN=LEFT STYLE="background: transparent; font-weight: medium">
	<FONT FACE="Verdana, sans-serif"><FONT SIZE=3>Why am I getting a
	NoSuchMethodException/Error or a NoSuchFieldException/Error?<BR><BR>Most
	likely, you're using a class that did exist prior to JDK 1.5, but a
	new method/field for that class that didn't exist prior to JDK 1.5.
	You can't use new JDK 1.5 classes/methods/fields in an earlier JVM.
	You can turn on the -verifyref option on Retroweaver to receive
	warnings when you reference classes, fields, or methods that don't
	exist in the VM that you are targetting.<BR></FONT></FONT><BR><BR>
	</P>
	<LI><P ALIGN=LEFT STYLE="background: transparent; font-weight: medium">
	<FONT FACE="Verdana, sans-serif"><FONT SIZE=3>How does serialization
	for enums work?<BR><BR>The new enum specification requires changes
	to the serialization specification, which are outside of the reach
	of Retroweaver. This means that serialization of enums behaves
	correctly, but differently, between 1.5 and earlier VMs. In other
	words, you can't just naively exchange enums between 1.5 and earlier
	VMs via serialization.<BR></FONT></FONT><BR><BR>
	</P>
	<LI><P ALIGN=LEFT STYLE="background: transparent; font-weight: medium; page-break-inside: avoid; page-break-before: auto">
	<FONT FACE="Verdana, sans-serif"><FONT SIZE=3>Why do I get a
	java.lang.IncompatibleClassChangeError?<BR><BR>Does it happen when
	you are using an Iterable? Currently, Retroweaver is unable to
	handle an assignment of a JDK 1.5 class that implements
	java.lang.Iterable to a java.lang.Iterable reference. See the test
	case, ItTest.java for more details. You can workaround this problem
	by wrapping the reference to the JDK 1.5 class in your own Iterable
	adapter.</FONT></FONT></P>
	<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"><FONT FACE="Verdana, sans-serif"><FONT SIZE=3><BR><BR></FONT></FONT><BR><BR>
	</P>
</UL>
<H2 CLASS="western" ALIGN=LEFT STYLE="background: transparent; page-break-before: always">
<FONT FACE="Verdana, sans-serif"><FONT SIZE=4 STYLE="font-size: 16pt"><B>Chapter
6: <SPAN LANG="en-US">Appendix</SPAN></B></FONT></FONT></H2>
<H3 CLASS="western" ALIGN=LEFT STYLE="background: #e6e6e6; font-weight: medium">
<FONT FACE="Verdana, sans-serif"><FONT SIZE=4>Ant Task Documentation</FONT></FONT></H3>
<H2 CLASS="western" ALIGN=LEFT STYLE="background: transparent">Description</H2>
<P><FONT FACE="Verdana, sans-serif">net.sourceforge.retroweaver.ant.RetroWeaverTask</FONT></P>
<P><FONT FACE="Verdana, sans-serif">Runs Retroweaver on a directory
or set of directories to convert classes produced by a JDK 1.5
compliant compiler to a class file format supported by older JVM's.</FONT></P>
<H3 CLASS="western"><FONT FACE="Verdana, sans-serif">Parameters</FONT></H3>
<TABLE WIDTH=576 BORDER=1 CELLPADDING=2 CELLSPACING=0>
	<COL WIDTH=121>
	<COL WIDTH=291>
	<COL WIDTH=150>
	<TR>
		<TH WIDTH=121 BGCOLOR="#e6e6e6">
			<P><FONT FACE="Verdana, sans-serif">Attribute</FONT></P>
		</TH>
		<TH WIDTH=291 BGCOLOR="#e6e6e6">
			<P ALIGN=LEFT><FONT FACE="Verdana, sans-serif">Description</FONT></P>
		</TH>
		<TH WIDTH=150 BGCOLOR="#e6e6e6">
			<P><FONT FACE="Verdana, sans-serif">Required</FONT></P>
		</TH>
	</TR>
	<TR>
		<TD WIDTH=121>
			<P><FONT FACE="Verdana, sans-serif">srcdir</FONT></P>
		</TD>
		<TD WIDTH=291>
			<P><FONT FACE="Verdana, sans-serif">The directory containing
			classes to process.</FONT></P>
		</TD>
		<TD WIDTH=150>
			<P><FONT FACE="Verdana, sans-serif">One of either <I>srcdir,
			inputjar</I> or a nested fileset element.</FONT></P>
		</TD>
	</TR>
	<TR>
		<TD WIDTH=121>
			<P><FONT FACE="Verdana, sans-serif">destdir</FONT></P>
		</TD>
		<TD WIDTH=291>
			<P><FONT FACE="Verdana, sans-serif">The destination directory for
			the processed classes.</FONT></P>
		</TD>
		<TD WIDTH=150>
			<P><FONT FACE="Verdana, sans-serif">No. If not specified, the
			processed classes overwrite the source classes.</FONT></P>
		</TD>
	</TR>
	<TR>
		<TD WIDTH=121>
			<P><FONT FACE="Verdana, sans-serif">inputjar</FONT></P>
		</TD>
		<TD WIDTH=291>
			<P><FONT FACE="Verdana, sans-serif">The jar file to proces.</FONT></P>
		</TD>
		<TD WIDTH=150>
			<P><FONT FACE="Verdana, sans-serif">One of either <I>srcdir,
			inputjar</I> or a nested fileset element.</FONT></P>
		</TD>
	</TR>
	<TR>
		<TD WIDTH=121>
			<P><FONT FACE="Verdana, sans-serif">outputjar</FONT></P>
		</TD>
		<TD WIDTH=291>
			<P><FONT FACE="Verdana, sans-serif">The jar file for the processed
			classes.</FONT></P>
		</TD>
		<TD WIDTH=150>
			<P><FONT FACE="Verdana, sans-serif">Yes if inputjar is specified.</FONT></P>
		</TD>
	</TR>
	<TR>
		<TD WIDTH=121>
			<P><FONT FACE="Verdana, sans-serif">classpath</FONT></P>
		</TD>
		<TD WIDTH=291>
			<P><FONT FACE="Verdana, sans-serif">The classpath for reference
			verification. For example,
			retroweaver-rt<SPAN STYLE="font-weight: medium"><FONT SIZE=3>-&lt;version&gt;</FONT></SPAN>.jar;c:\java\jdk1.4\lib\rt.jar;my-classes</FONT></P>
		</TD>
		<TD WIDTH=150>
			<P><FONT FACE="Verdana, sans-serif">No. If not specified,
			Retroweaver will not verify references.</FONT></P>
		</TD>
	</TR>
	<TR>
		<TD WIDTH=121>
			<P><FONT FACE="Verdana, sans-serif">verify</FONT></P>
		</TD>
		<TD WIDTH=291>
			<P><FONT FACE="Verdana, sans-serif">Indicates whether the verifier
			should be called. Note that the verifier is skipped if c<I>lasspath
			</I><SPAN STYLE="font-style: normal">is not defined.</SPAN></FONT></P>
		</TD>
		<TD WIDTH=150>
			<P><FONT FACE="Verdana, sans-serif">No. Defaults to true.</FONT></P>
		</TD>
	</TR>
	<TR>
		<TD WIDTH=121>
			<P><FONT FACE="Verdana, sans-serif">target</FONT></P>
		</TD>
		<TD WIDTH=291>
			<P><FONT FACE="Verdana, sans-serif">The target version as either
			&quot;1.2&quot;, &quot;1.3&quot;, or &quot;1.4&quot;.</FONT></P>
		</TD>
		<TD WIDTH=150>
			<P><FONT FACE="Verdana, sans-serif">No. Defaults to &quot;1.4&quot;.</FONT></P>
		</TD>
	</TR>
	<TR>
		<TD WIDTH=121>
			<P><FONT FACE="Verdana, sans-serif">stripSignatures</FONT></P>
		</TD>
		<TD WIDTH=291>
			<P><FONT FACE="Verdana, sans-serif">Indicates whether the generic
			signatures should be stripped.<BR></FONT><BR>
			</P>
		</TD>
		<TD WIDTH=150>
			<P><FONT FACE="Verdana, sans-serif">No. Defaults to false.</FONT></P>
		</TD>
	</TR>
	<TR>
		<TD WIDTH=121>
			<P><FONT FACE="Verdana, sans-serif">stripAttributes</FONT></P>
		</TD>
		<TD WIDTH=291>
			<P><FONT FACE="Verdana, sans-serif">Indicates whether the custom
			Retroweaver attributes should be stripped.<BR></FONT><BR>
			</P>
		</TD>
		<TD WIDTH=150>
			<P><FONT FACE="Verdana, sans-serif">No. Defaults to false.</FONT></P>
		</TD>
	</TR>
	<TR>
		<TD WIDTH=121>
			<P><FONT FACE="Verdana, sans-serif">lazy</FONT></P>
		</TD>
		<TD WIDTH=291>
			<P><FONT FACE="Verdana, sans-serif">Indicates if classes that
			already have the target version should be skipped. If the
			destination directory is different from the source directory, such
			classes are copied to the destination with preserved timestamp.</FONT></P>
		</TD>
		<TD WIDTH=150>
			<P><FONT FACE="Verdana, sans-serif">No. Defaults to true.</FONT></P>
		</TD>
	</TR>
	<TR>
		<TD WIDTH=121>
			<P><FONT FACE="Verdana, sans-serif">failonerror</FONT></P>
		</TD>
		<TD WIDTH=291>
			<P><FONT FACE="Verdana, sans-serif">Indicates if the build should
			fail if an error occurs while processing classes. If false, a
			warning is logged but the build continues.</FONT></P>
		</TD>
		<TD WIDTH=150>
			<P><FONT FACE="Verdana, sans-serif">No. Defaults to true.</FONT></P>
		</TD>
	</TR>
	<TR>
		<TD WIDTH=121>
			<P><FONT FACE="Verdana, sans-serif">verbose</FONT></P>
		</TD>
		<TD WIDTH=291>
			<P><FONT FACE="Verdana, sans-serif">Indicates if the names of
			processed files should be logged.</FONT></P>
		</TD>
		<TD WIDTH=150>
			<P><FONT FACE="Verdana, sans-serif">No. Defaults to false.</FONT></P>
		</TD>
	</TR>
</TABLE>
<H3 CLASS="western"><FONT FACE="Verdana, sans-serif">Parameters
specified as nested elements</FONT></H3>
<H4 CLASS="western"><FONT FACE="Verdana, sans-serif">fileset</FONT></H4>
<P><FONT FACE="Verdana, sans-serif">One ore more filesets can be
specified instead of (or in addition to) the <I>srcdir</I> attribute.
Make sure that the fileset only includes class files.</FONT></P>
<H3 CLASS="western"><FONT FACE="Verdana, sans-serif">Examples</FONT></H3>
<H4 CLASS="western"><FONT FACE="Verdana, sans-serif">Declare the
Retroweaver class. The example assumes that the property
&quot;retroweaver.home&quot; points to the RetroWeaver installation.</FONT></H4>
<PRE>  &lt;taskdef name=&quot;retroweaver&quot; classname=&quot;net.sourceforge.retroweaver.ant.RetroWeaverTask&quot;&gt;
    &lt;classpath&gt;
      &lt;fileset dir=&quot;${retroweaver.home}/lib&quot; includes=&quot;**/*&quot;/&gt;
      &lt;pathelement location=&quot;${retroweaver.home}/release/retroweaver-&lt;version&gt;.jar&quot;/&gt;
    &lt;/classpath&gt;
  &lt;/taskdef&gt;</PRE><H4 CLASS="western">
Convert a set of classes in a single directory to JDK 1.4 compatible
format.</H4>
<PRE>  &lt;target name=&quot;weave&quot; depends=&quot;compile&quot;&gt;
    &lt;retroweaver srcdir=&quot;classes&quot;/&gt;
  &lt;/target&gt;</PRE><H4 CLASS="western">
Convert a set of classes, using a fileset, to JDK 1.3 compatible
format in another directory.</H4>
<PRE>  &lt;target name=&quot;weave&quot; depends=&quot;compile&quot;&gt;
    &lt;mkdir dir=&quot;classes-13&quot;/&gt;
    &lt;retroweaver destdir=&quot;classes-13&quot; target=&quot;1.3&quot;&gt;
      &lt;fileset dir=&quot;classes&quot;&gt;
        &lt;include name=&quot;**/*.class&quot;/&gt;
      &lt;/fileset&gt;
    &lt;/retroweaver&gt;
  &lt;/target&gt;</PRE><P STYLE="margin-bottom: 0in">
<BR>
</P>
<P STYLE="margin-bottom: 0in; page-break-before: always"><FONT FACE="Verdana, sans-serif"><FONT SIZE=4 STYLE="font-size: 16pt"><B>Chapter
6: <SPAN LANG="en-US">Acknowledgments</SPAN></B></FONT></FONT></P>
<P ALIGN=LEFT STYLE="background: transparent"><BR><BR>
</P>
<H3 CLASS="western" ALIGN=LEFT STYLE="background: #e6e6e6; font-weight: medium">
<FONT FACE="Verdana, sans-serif"><FONT SIZE=4>Thanks Go To</FONT></FONT></H3>
<P ALIGN=LEFT STYLE="background: transparent; font-weight: medium"><BR><BR>
</P>
<UL>
	<LI><P ALIGN=LEFT STYLE="background: transparent; font-weight: medium">
	<FONT FACE="Verdana, sans-serif"><FONT SIZE=3>My wife, who
	continually puts up with my pursuit of all things arcane.</FONT></FONT></P>
</UL>
<UL>
	<LI><P ALIGN=LEFT STYLE="background: transparent; font-weight: medium">
	<FONT FACE="Verdana, sans-serif"><FONT SIZE=3>Neal Gafter, who was
	responsible for providing most of the information that made
	Retroweaver possible. </FONT></FONT>
	</P>
	<LI><P ALIGN=LEFT STYLE="background: transparent; font-weight: medium">
	<FONT FACE="Verdana, sans-serif"><FONT SIZE=3>Sean Shubin, who has
	donated some usability improvements to Retroweaver.</FONT></FONT></P>
	<LI><P ALIGN=LEFT STYLE="background: transparent; font-weight: medium">
	<FONT FACE="Verdana, sans-serif"><FONT SIZE=3>Gunnar Grim, who has
	donated the Ant task.</FONT></FONT></P>
</UL>
<UL>
	<P ALIGN=LEFT STYLE="background: transparent"></P>
</UL>
</BODY>
</HTML>